package arpui.common;

import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.ProgressIndicator;
import javafx.scene.layout.Border;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.BorderStroke;
import javafx.scene.layout.BorderStrokeStyle;
import javafx.scene.layout.BorderWidths;
import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.scene.text.TextAlignment;

public class FXStatusBar extends BorderPane{
	private Label tipInfo = null;
	private ProgressBar bp = null;
	private ProgressIndicator pi = null;

	public FXStatusBar(){
		this.setPadding(new Insets(5));
		
		tipInfo = new Label("  提示信息...");
		bp = new ProgressBar();
		bp.setProgress(-1);
		pi = new ProgressIndicator();
		pi.setProgress(-1);
		
		this.setCenter(tipInfo);
		this.setAlignment(tipInfo, Pos.CENTER_LEFT);
		this.setAlignment(pi, Pos.CENTER_LEFT);
		
		BorderStroke bs = 
				new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID, new CornerRadii(5), new BorderWidths(1));
		Border statusBorder = new Border(bs);
		this.setBorder(statusBorder);
	}
	
	public FXStatusBar(int w,int h){
		this();
		this.setPrefSize(w, h);
	}
	
	public void setTipInfo(String info,int isRun){
		tipInfo.setText("  "+info);
		if(isRun == 0){
			this.setLeft(bp);
		}else{
			this.setLeft(null);
		}
	}
}
